<?php

namespace app\admin\service\traits;

use app\model\Shop;
use app\model\User;
use app\model\UserLevel;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\facade\Cache;
use think\Model;

trait BaseTrait
{

    public function create($data){
        // 清除缓存
        Cache::tag($this->model->getTable())->clear();
        $class = get_class($this->model);
        return $class::create($data);
    }

    public function update($data, $where){
        // 清除缓存
        Cache::tag($this->model->getTable())->clear();
        $class = get_class($this->model);
        return $class::update($data, $where);
    }

    public function destroy($ids, $isForce=false){
        // 清除缓存
        Cache::tag($this->model->getTable())->clear();
        $class = get_class($this->model);
        return $class::destroy($ids, $isForce);

    }

}
